﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ANN.FeedForward {
    public class Layer : ILayer {
        public Layer(int neurons, int inputs) {
            // Create ActivationFunction object
            ANN.Math.Sigmoid Sigmoid = new ANN.Math.Sigmoid();

            // Create collection of neurons
            Neurons = new Neuron[neurons];

            for (int i = 0; i < neurons; i++) {
                Neurons[i] = new Neuron(inputs, Sigmoid);
            }
        }

        public override float[] Calculate(float[] inputs) {
            // Create a new array for the ouputs
            float[] outputs = new float[Neurons.Length];

            // Calculate each neurons output
            for(int i = 0; i < Neurons.Length; i++) {
                outputs[i] = Neurons[i].Calculate(inputs);
            }

            return outputs;
        }
    }
}
